package com.cxs.plan.controller.bill;

import com.cxs.plan.domain.HttpResult;
import com.cxs.plan.domain.entity.Budget;
import com.cxs.plan.service.BudgetService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/bill/budget")
public class BudgetController {

    @Autowired
    private BudgetService budgetService;

    @GetMapping
    public HttpResult getUserBudget() {
        return HttpResult.success(budgetService.selectUserBudget());
    }

    @PostMapping
    public HttpResult saveUserBudget(@RequestBody Budget budget){
        budgetService.saveUserBudget(budget);
        return HttpResult.success();
    }
}
